import api from '../index'
import type { PolluteErrRow, PowerSupplyStatRow, QueryDataTime } from './types/data.query'
import type { RowListRes } from './types/ent'

export default {
  // 异常明细接口
  GetReuseExDetails: (data: QueryDataTime) => api<RowListRes<PolluteErrRow>>({
    url: `/Env/Data/GetReuseExDetails`,
    method: 'post',
    data,
  }),
  // 生产设施运行曲线
  GetProduceDatas: (data: { produceObjIDs: string[], startTime: string, endTime: string }) => api({
    url: `/Env/Data/GetProduceDatas`,
    method: 'post',
    data,
  }),
  // 生产设施运行曲线
  GetElectricTS: (data: { deviceObjIDs: string[], markerIDs: number[], startTime: string, endTime: string }) => api({
    url: `/Electric/GetElectricTS`,
    method: 'post',
    data,
  }),
  // 治理设施异常
  GetReuseEx: (data: { objIDs: string[], startTime: string, endTime: string }) => api({
    url: `/Env/Data/GetReuseEx`,
    method: 'post',
    data,
  }),
  // 停上电列表
  GetDevicePowerSupplyStatDetail: (data: QueryDataTime) => api<RowListRes<PowerSupplyStatRow>>({
    url: `/Env/Data/GetDevicePowerSupplyStatDetail`,
    method: 'post',
    data,
  }),
  // 停电明细
  GetPowerSupplyList: (data: { startTime: string, endTime: string, deviceIDs: string[], pageSize: number, pageNum: number }) => api<any>({
    url: `/Obj/Device/GetPowerSupplyList`,
    method: 'post',
    data,
  }),
  // 企业日用单量
  GetEnterpriseElecEveryday: (data: { startTime: string, endTime: string, objFilter: any, pageSize: number, pageNum: number }) => api<any>({
    url: `/Env/Data/GetEnterpriseElecEveryday`,
    method: 'post',
    data,
  }),
  // 异常处置状态
  GetExDeclareStates: () => api<any>({
    url: `/Env/Declare/GetExDeclareStates`,
    method: 'post',
  }),
  // 获取检修申报数据
  GetOverhaulDeclare: (data: { startTime: string, endTime: string, declareIDs: string[], entNames: string[], stateIDs: string[], pageSize: number, pageNum: number }) => api<any>({
    url: `/Env/Declare/GetOverhaulDeclare`,
    method: 'post',
    data,
  }),
  // 检修申报-环保局通过
  OverhaulDeclareOrgPass: (data: { declareID: string, inspectContent: string, inspectName: string, inspectTel: string }) => api<any>({
    url: `/Env/Declare/OverhaulDeclareOrgPass`,
    method: 'post',
    data,
  }),
  // 检修申报-环保局退回
  OverhaulDeclareOrgBack: (data: { declareID: string, inspectContent: string, inspectName: string, inspectTel: string }) => api<any>({
    url: `/Env/Declare/OverhaulDeclareOrgBack`,
    method: 'post',
    data,
  }),
  // 上传检修申报附件
  AddOverhaulDeclareFile: (data: { declareID: string, file: any }) => api<any>({
    url: `/Env/Declare/AddOverhaulDeclareFile`,
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data',
    } as any,
  }),
  // 上传异常处置附件
  AddExDeclareFile: (data: { produceObjID: string, reusePartObjID: string, startTime: string, file: any }) => api<any>({
    url: `/Env/Declare/AddExDeclareFile`,
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data',
    } as any,
  }),
  // 删除检修申报附件
  DeleteOverhaulDeclareFile: (data: { fileID: string }) => api<any>({
    url: `/Env/Declare/DeleteOverhaulDeclareFile`,
    method: 'post',
    data,
  }),
  // 删除异常处置附件
  DeleteExDeclareFile: (data: { fileID: string }) => api<any>({
    url: `/Env/Declare/DeleteExDeclareFile`,
    method: 'post',
    data,
  }),
  // 获取检修申报附件
  GetOverhaulDeclareFile: (data: { fileID: string }) => api<any>({
    url: `/Env/Declare/GetOverhaulDeclareFile`,
    method: 'post',
    data,
    responseType: 'blob',
  }),
  // 获取异常处置附件
  GetExDeclareFile: (data: { fileID: string }) => api<any>({
    url: `/Env/Declare/GetExDeclareFile`,
    method: 'post',
    data,
    responseType: 'blob',
  }),
  // 检修申报-企业申报
  OverhaulDeclareEnt: (data: { declareID: string, reuseObjID: string, startTime: string, endTime: string, reportContent: string, reportName: string, reportTel: string }) => api<any>({
    url: `/Env/Declare/OverhaulDeclareEnt`,
    method: 'post',
    data,
  }),
  // 异常处置-企业申报
  ReuseExDeclareEnt: (data: { produceObjID: string, reusePartObjID: string, startTime: string, reportContent: string, reportName: string, reportTel: string }) => api<any>({
    url: `/Env/Declare/ReuseExDeclareEnt`,
    method: 'post',
    data,
  }),
  // 异常处置详情
  GetReuseExDeclare: (data: { produceObjID: string, reusePartObjID: string, startTime: string }) => api<any>({
    url: `/Env/Declare/GetReuseExDeclare`,
    method: 'post',
    data,
  }),
  // 异常处置-环保局通过
  ReuseExDeclareEnvOrgPass: (data: { produceObjID: string, reusePartObjID: string, startTime: string, inspectContent: string, inspectName: string, inspectTel: string }) => api<any>({
    url: `/Env/Declare/ReuseExDeclareEnvOrgPass`,
    method: 'post',
    data,
  }),
  // 异常处置-环保局退回
  ReuseExDeclareEnvOrgBack: (data: { produceObjID: string, reusePartObjID: string, startTime: string, inspectContent: string, inspectName: string, inspectTel: string }) => api<any>({
    url: `/Env/Declare/ReuseExDeclareEnvOrgBack`,
    method: 'post',
    data,
  }),
}
